
/*
'===============================================================================
'  Generated From - CSharp_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  ** 
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'abstract' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  public class YourObject :  _YourObject
'  {
'
'  }
'
'===============================================================================
*/

// Generated by MyGeneration Version # (1.3.0.3)

using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Collections.Specialized;

using MyGeneration.dOOdads;

namespace POSSystem.DAL
{
	public abstract class _CustomerOrders : SqlClientEntity
	{
		public _CustomerOrders()
		{
			this.QuerySource = "CustomerOrders";
			this.MappingName = "CustomerOrders";

		}	

		//=================================================================
		//  public Overrides void AddNew()
		//=================================================================
		//
		//=================================================================
		public override void AddNew()
		{
			base.AddNew();
			
		}
		
		
		public override void FlushData()
		{
			this._whereClause = null;
			this._aggregateClause = null;
			base.FlushData();
		}
		
		//=================================================================
		//  	public Function LoadAll() As Boolean
		//=================================================================
		//  Loads all of the records in the database, and sets the currentRow to the first row
		//=================================================================
		public bool LoadAll() 
		{
			ListDictionary parameters = null;
			
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_CustomerOrdersLoadAll]", parameters);
		}
	
		//=================================================================
		// public Overridable Function LoadByPrimaryKey()  As Boolean
		//=================================================================
		//  Loads a single row of via the primary key
		//=================================================================
		public virtual bool LoadByPrimaryKey(int ID)
		{
			ListDictionary parameters = new ListDictionary();
			parameters.Add(Parameters.ID, ID);

		
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_CustomerOrdersLoadByPrimaryKey]", parameters);
		}
		
		#region Parameters
		protected class Parameters
		{
			
			public static SqlParameter ID
			{
				get
				{
					return new SqlParameter("@ID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter OrderNo
			{
				get
				{
					return new SqlParameter("@OrderNo", SqlDbType.Char, 10);
				}
			}
			
			public static SqlParameter CustomerID
			{
				get
				{
					return new SqlParameter("@CustomerID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter CustomerAddress
			{
				get
				{
					return new SqlParameter("@CustomerAddress", SqlDbType.NVarChar, 200);
				}
			}
			
			public static SqlParameter CustomerName
			{
				get
				{
					return new SqlParameter("@CustomerName", SqlDbType.NVarChar, 50);
				}
			}
			
			public static SqlParameter CustomerPhone
			{
				get
				{
					return new SqlParameter("@CustomerPhone", SqlDbType.NVarChar, 20);
				}
			}
			
			public static SqlParameter PreferredShipDate
			{
				get
				{
					return new SqlParameter("@PreferredShipDate", SqlDbType.DateTime, 0);
				}
			}
			
			public static SqlParameter ShipAddress
			{
				get
				{
					return new SqlParameter("@ShipAddress", SqlDbType.NVarChar, 200);
				}
			}
			
			public static SqlParameter Note
			{
				get
				{
					return new SqlParameter("@Note", SqlDbType.NVarChar, 1073741823);
				}
			}
			
			public static SqlParameter ShipDate
			{
				get
				{
					return new SqlParameter("@ShipDate", SqlDbType.DateTime, 0);
				}
			}
			
			public static SqlParameter PaymentMethodID
			{
				get
				{
					return new SqlParameter("@PaymentMethodID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter TotalAmount
			{
				get
				{
					return new SqlParameter("@TotalAmount", SqlDbType.Decimal, 0);
				}
			}
			
			public static SqlParameter GST
			{
				get
				{
					return new SqlParameter("@GST", SqlDbType.Decimal, 0);
				}
			}
			
			public static SqlParameter StatusID
			{
				get
				{
					return new SqlParameter("@StatusID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter InvoiceID
			{
				get
				{
					return new SqlParameter("@InvoiceID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter Deleted
			{
				get
				{
					return new SqlParameter("@Deleted", SqlDbType.Bit, 0);
				}
			}
			
			public static SqlParameter CreatedDate
			{
				get
				{
					return new SqlParameter("@CreatedDate", SqlDbType.DateTime, 0);
				}
			}
			
			public static SqlParameter LastModifiedDate
			{
				get
				{
					return new SqlParameter("@LastModifiedDate", SqlDbType.DateTime, 0);
				}
			}
			
			public static SqlParameter LastModifiedByUser
			{
				get
				{
					return new SqlParameter("@LastModifiedByUser", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter LastModifiedByCustomer
			{
				get
				{
					return new SqlParameter("@LastModifiedByCustomer", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter BranchID
			{
				get
				{
					return new SqlParameter("@BranchID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter VoucherID
			{
				get
				{
					return new SqlParameter("@VoucherID", SqlDbType.UniqueIdentifier, 0);
				}
			}
			
		}
		#endregion		
	
		#region ColumnNames
		public class ColumnNames
		{  
            public const string ID = "ID";
            public const string OrderNo = "OrderNo";
            public const string CustomerID = "CustomerID";
            public const string CustomerAddress = "CustomerAddress";
            public const string CustomerName = "CustomerName";
            public const string CustomerPhone = "CustomerPhone";
            public const string PreferredShipDate = "PreferredShipDate";
            public const string ShipAddress = "ShipAddress";
            public const string Note = "Note";
            public const string ShipDate = "ShipDate";
            public const string PaymentMethodID = "PaymentMethodID";
            public const string TotalAmount = "TotalAmount";
            public const string GST = "GST";
            public const string StatusID = "StatusID";
            public const string InvoiceID = "InvoiceID";
            public const string Deleted = "Deleted";
            public const string CreatedDate = "CreatedDate";
            public const string LastModifiedDate = "LastModifiedDate";
            public const string LastModifiedByUser = "LastModifiedByUser";
            public const string LastModifiedByCustomer = "LastModifiedByCustomer";
            public const string BranchID = "BranchID";
            public const string VoucherID = "VoucherID";

			static public string ToPropertyName(string columnName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[ID] = _CustomerOrders.PropertyNames.ID;
					ht[OrderNo] = _CustomerOrders.PropertyNames.OrderNo;
					ht[CustomerID] = _CustomerOrders.PropertyNames.CustomerID;
					ht[CustomerAddress] = _CustomerOrders.PropertyNames.CustomerAddress;
					ht[CustomerName] = _CustomerOrders.PropertyNames.CustomerName;
					ht[CustomerPhone] = _CustomerOrders.PropertyNames.CustomerPhone;
					ht[PreferredShipDate] = _CustomerOrders.PropertyNames.PreferredShipDate;
					ht[ShipAddress] = _CustomerOrders.PropertyNames.ShipAddress;
					ht[Note] = _CustomerOrders.PropertyNames.Note;
					ht[ShipDate] = _CustomerOrders.PropertyNames.ShipDate;
					ht[PaymentMethodID] = _CustomerOrders.PropertyNames.PaymentMethodID;
					ht[TotalAmount] = _CustomerOrders.PropertyNames.TotalAmount;
					ht[GST] = _CustomerOrders.PropertyNames.GST;
					ht[StatusID] = _CustomerOrders.PropertyNames.StatusID;
					ht[InvoiceID] = _CustomerOrders.PropertyNames.InvoiceID;
					ht[Deleted] = _CustomerOrders.PropertyNames.Deleted;
					ht[CreatedDate] = _CustomerOrders.PropertyNames.CreatedDate;
					ht[LastModifiedDate] = _CustomerOrders.PropertyNames.LastModifiedDate;
					ht[LastModifiedByUser] = _CustomerOrders.PropertyNames.LastModifiedByUser;
					ht[LastModifiedByCustomer] = _CustomerOrders.PropertyNames.LastModifiedByCustomer;
					ht[BranchID] = _CustomerOrders.PropertyNames.BranchID;
					ht[VoucherID] = _CustomerOrders.PropertyNames.VoucherID;

				}
				return (string)ht[columnName];
			}

			static private Hashtable ht = null;			 
		}
		#endregion
		
		#region PropertyNames
		public class PropertyNames
		{  
            public const string ID = "ID";
            public const string OrderNo = "OrderNo";
            public const string CustomerID = "CustomerID";
            public const string CustomerAddress = "CustomerAddress";
            public const string CustomerName = "CustomerName";
            public const string CustomerPhone = "CustomerPhone";
            public const string PreferredShipDate = "PreferredShipDate";
            public const string ShipAddress = "ShipAddress";
            public const string Note = "Note";
            public const string ShipDate = "ShipDate";
            public const string PaymentMethodID = "PaymentMethodID";
            public const string TotalAmount = "TotalAmount";
            public const string GST = "GST";
            public const string StatusID = "StatusID";
            public const string InvoiceID = "InvoiceID";
            public const string Deleted = "Deleted";
            public const string CreatedDate = "CreatedDate";
            public const string LastModifiedDate = "LastModifiedDate";
            public const string LastModifiedByUser = "LastModifiedByUser";
            public const string LastModifiedByCustomer = "LastModifiedByCustomer";
            public const string BranchID = "BranchID";
            public const string VoucherID = "VoucherID";

			static public string ToColumnName(string propertyName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[ID] = _CustomerOrders.ColumnNames.ID;
					ht[OrderNo] = _CustomerOrders.ColumnNames.OrderNo;
					ht[CustomerID] = _CustomerOrders.ColumnNames.CustomerID;
					ht[CustomerAddress] = _CustomerOrders.ColumnNames.CustomerAddress;
					ht[CustomerName] = _CustomerOrders.ColumnNames.CustomerName;
					ht[CustomerPhone] = _CustomerOrders.ColumnNames.CustomerPhone;
					ht[PreferredShipDate] = _CustomerOrders.ColumnNames.PreferredShipDate;
					ht[ShipAddress] = _CustomerOrders.ColumnNames.ShipAddress;
					ht[Note] = _CustomerOrders.ColumnNames.Note;
					ht[ShipDate] = _CustomerOrders.ColumnNames.ShipDate;
					ht[PaymentMethodID] = _CustomerOrders.ColumnNames.PaymentMethodID;
					ht[TotalAmount] = _CustomerOrders.ColumnNames.TotalAmount;
					ht[GST] = _CustomerOrders.ColumnNames.GST;
					ht[StatusID] = _CustomerOrders.ColumnNames.StatusID;
					ht[InvoiceID] = _CustomerOrders.ColumnNames.InvoiceID;
					ht[Deleted] = _CustomerOrders.ColumnNames.Deleted;
					ht[CreatedDate] = _CustomerOrders.ColumnNames.CreatedDate;
					ht[LastModifiedDate] = _CustomerOrders.ColumnNames.LastModifiedDate;
					ht[LastModifiedByUser] = _CustomerOrders.ColumnNames.LastModifiedByUser;
					ht[LastModifiedByCustomer] = _CustomerOrders.ColumnNames.LastModifiedByCustomer;
					ht[BranchID] = _CustomerOrders.ColumnNames.BranchID;
					ht[VoucherID] = _CustomerOrders.ColumnNames.VoucherID;

				}
				return (string)ht[propertyName];
			}

			static private Hashtable ht = null;			 
		}			 
		#endregion	

		#region StringPropertyNames
		public class StringPropertyNames
		{  
            public const string ID = "s_ID";
            public const string OrderNo = "s_OrderNo";
            public const string CustomerID = "s_CustomerID";
            public const string CustomerAddress = "s_CustomerAddress";
            public const string CustomerName = "s_CustomerName";
            public const string CustomerPhone = "s_CustomerPhone";
            public const string PreferredShipDate = "s_PreferredShipDate";
            public const string ShipAddress = "s_ShipAddress";
            public const string Note = "s_Note";
            public const string ShipDate = "s_ShipDate";
            public const string PaymentMethodID = "s_PaymentMethodID";
            public const string TotalAmount = "s_TotalAmount";
            public const string GST = "s_GST";
            public const string StatusID = "s_StatusID";
            public const string InvoiceID = "s_InvoiceID";
            public const string Deleted = "s_Deleted";
            public const string CreatedDate = "s_CreatedDate";
            public const string LastModifiedDate = "s_LastModifiedDate";
            public const string LastModifiedByUser = "s_LastModifiedByUser";
            public const string LastModifiedByCustomer = "s_LastModifiedByCustomer";
            public const string BranchID = "s_BranchID";
            public const string VoucherID = "s_VoucherID";

		}
		#endregion		
		
		#region Properties
	
		public virtual int ID
	    {
			get
	        {
				return base.Getint(ColumnNames.ID);
			}
			set
	        {
				base.Setint(ColumnNames.ID, value);
			}
		}

		public virtual string OrderNo
	    {
			get
	        {
				return base.Getstring(ColumnNames.OrderNo);
			}
			set
	        {
				base.Setstring(ColumnNames.OrderNo, value);
			}
		}

		public virtual int CustomerID
	    {
			get
	        {
				return base.Getint(ColumnNames.CustomerID);
			}
			set
	        {
				base.Setint(ColumnNames.CustomerID, value);
			}
		}

		public virtual string CustomerAddress
	    {
			get
	        {
				return base.Getstring(ColumnNames.CustomerAddress);
			}
			set
	        {
				base.Setstring(ColumnNames.CustomerAddress, value);
			}
		}

		public virtual string CustomerName
	    {
			get
	        {
				return base.Getstring(ColumnNames.CustomerName);
			}
			set
	        {
				base.Setstring(ColumnNames.CustomerName, value);
			}
		}

		public virtual string CustomerPhone
	    {
			get
	        {
				return base.Getstring(ColumnNames.CustomerPhone);
			}
			set
	        {
				base.Setstring(ColumnNames.CustomerPhone, value);
			}
		}

		public virtual DateTime PreferredShipDate
	    {
			get
	        {
				return base.GetDateTime(ColumnNames.PreferredShipDate);
			}
			set
	        {
				base.SetDateTime(ColumnNames.PreferredShipDate, value);
			}
		}

		public virtual string ShipAddress
	    {
			get
	        {
				return base.Getstring(ColumnNames.ShipAddress);
			}
			set
	        {
				base.Setstring(ColumnNames.ShipAddress, value);
			}
		}

		public virtual string Note
	    {
			get
	        {
				return base.Getstring(ColumnNames.Note);
			}
			set
	        {
				base.Setstring(ColumnNames.Note, value);
			}
		}

		public virtual DateTime ShipDate
	    {
			get
	        {
				return base.GetDateTime(ColumnNames.ShipDate);
			}
			set
	        {
				base.SetDateTime(ColumnNames.ShipDate, value);
			}
		}

		public virtual int PaymentMethodID
	    {
			get
	        {
				return base.Getint(ColumnNames.PaymentMethodID);
			}
			set
	        {
				base.Setint(ColumnNames.PaymentMethodID, value);
			}
		}

		public virtual decimal TotalAmount
	    {
			get
	        {
				return base.Getdecimal(ColumnNames.TotalAmount);
			}
			set
	        {
				base.Setdecimal(ColumnNames.TotalAmount, value);
			}
		}

		public virtual decimal GST
	    {
			get
	        {
				return base.Getdecimal(ColumnNames.GST);
			}
			set
	        {
				base.Setdecimal(ColumnNames.GST, value);
			}
		}

		public virtual int StatusID
	    {
			get
	        {
				return base.Getint(ColumnNames.StatusID);
			}
			set
	        {
				base.Setint(ColumnNames.StatusID, value);
			}
		}

		public virtual int InvoiceID
	    {
			get
	        {
				return base.Getint(ColumnNames.InvoiceID);
			}
			set
	        {
				base.Setint(ColumnNames.InvoiceID, value);
			}
		}

		public virtual bool Deleted
	    {
			get
	        {
				return base.Getbool(ColumnNames.Deleted);
			}
			set
	        {
				base.Setbool(ColumnNames.Deleted, value);
			}
		}

		public virtual DateTime CreatedDate
	    {
			get
	        {
				return base.GetDateTime(ColumnNames.CreatedDate);
			}
			set
	        {
				base.SetDateTime(ColumnNames.CreatedDate, value);
			}
		}

		public virtual DateTime LastModifiedDate
	    {
			get
	        {
				return base.GetDateTime(ColumnNames.LastModifiedDate);
			}
			set
	        {
				base.SetDateTime(ColumnNames.LastModifiedDate, value);
			}
		}

		public virtual int LastModifiedByUser
	    {
			get
	        {
				return base.Getint(ColumnNames.LastModifiedByUser);
			}
			set
	        {
				base.Setint(ColumnNames.LastModifiedByUser, value);
			}
		}

		public virtual int LastModifiedByCustomer
	    {
			get
	        {
				return base.Getint(ColumnNames.LastModifiedByCustomer);
			}
			set
	        {
				base.Setint(ColumnNames.LastModifiedByCustomer, value);
			}
		}

		public virtual int BranchID
	    {
			get
	        {
				return base.Getint(ColumnNames.BranchID);
			}
			set
	        {
				base.Setint(ColumnNames.BranchID, value);
			}
		}

		public virtual Guid VoucherID
	    {
			get
	        {
				return base.GetGuid(ColumnNames.VoucherID);
			}
			set
	        {
				base.SetGuid(ColumnNames.VoucherID, value);
			}
		}


		#endregion
		
		#region String Properties
	
		public virtual string s_ID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ID) ? string.Empty : base.GetintAsString(ColumnNames.ID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ID);
				else
					this.ID = base.SetintAsString(ColumnNames.ID, value);
			}
		}

		public virtual string s_OrderNo
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.OrderNo) ? string.Empty : base.GetstringAsString(ColumnNames.OrderNo);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.OrderNo);
				else
					this.OrderNo = base.SetstringAsString(ColumnNames.OrderNo, value);
			}
		}

		public virtual string s_CustomerID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.CustomerID) ? string.Empty : base.GetintAsString(ColumnNames.CustomerID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.CustomerID);
				else
					this.CustomerID = base.SetintAsString(ColumnNames.CustomerID, value);
			}
		}

		public virtual string s_CustomerAddress
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.CustomerAddress) ? string.Empty : base.GetstringAsString(ColumnNames.CustomerAddress);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.CustomerAddress);
				else
					this.CustomerAddress = base.SetstringAsString(ColumnNames.CustomerAddress, value);
			}
		}

		public virtual string s_CustomerName
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.CustomerName) ? string.Empty : base.GetstringAsString(ColumnNames.CustomerName);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.CustomerName);
				else
					this.CustomerName = base.SetstringAsString(ColumnNames.CustomerName, value);
			}
		}

		public virtual string s_CustomerPhone
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.CustomerPhone) ? string.Empty : base.GetstringAsString(ColumnNames.CustomerPhone);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.CustomerPhone);
				else
					this.CustomerPhone = base.SetstringAsString(ColumnNames.CustomerPhone, value);
			}
		}

		public virtual string s_PreferredShipDate
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.PreferredShipDate) ? string.Empty : base.GetDateTimeAsString(ColumnNames.PreferredShipDate);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.PreferredShipDate);
				else
					this.PreferredShipDate = base.SetDateTimeAsString(ColumnNames.PreferredShipDate, value);
			}
		}

		public virtual string s_ShipAddress
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ShipAddress) ? string.Empty : base.GetstringAsString(ColumnNames.ShipAddress);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ShipAddress);
				else
					this.ShipAddress = base.SetstringAsString(ColumnNames.ShipAddress, value);
			}
		}

		public virtual string s_Note
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Note) ? string.Empty : base.GetstringAsString(ColumnNames.Note);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Note);
				else
					this.Note = base.SetstringAsString(ColumnNames.Note, value);
			}
		}

		public virtual string s_ShipDate
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ShipDate) ? string.Empty : base.GetDateTimeAsString(ColumnNames.ShipDate);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ShipDate);
				else
					this.ShipDate = base.SetDateTimeAsString(ColumnNames.ShipDate, value);
			}
		}

		public virtual string s_PaymentMethodID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.PaymentMethodID) ? string.Empty : base.GetintAsString(ColumnNames.PaymentMethodID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.PaymentMethodID);
				else
					this.PaymentMethodID = base.SetintAsString(ColumnNames.PaymentMethodID, value);
			}
		}

		public virtual string s_TotalAmount
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.TotalAmount) ? string.Empty : base.GetdecimalAsString(ColumnNames.TotalAmount);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.TotalAmount);
				else
					this.TotalAmount = base.SetdecimalAsString(ColumnNames.TotalAmount, value);
			}
		}

		public virtual string s_GST
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.GST) ? string.Empty : base.GetdecimalAsString(ColumnNames.GST);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.GST);
				else
					this.GST = base.SetdecimalAsString(ColumnNames.GST, value);
			}
		}

		public virtual string s_StatusID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.StatusID) ? string.Empty : base.GetintAsString(ColumnNames.StatusID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.StatusID);
				else
					this.StatusID = base.SetintAsString(ColumnNames.StatusID, value);
			}
		}

		public virtual string s_InvoiceID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.InvoiceID) ? string.Empty : base.GetintAsString(ColumnNames.InvoiceID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.InvoiceID);
				else
					this.InvoiceID = base.SetintAsString(ColumnNames.InvoiceID, value);
			}
		}

		public virtual string s_Deleted
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Deleted) ? string.Empty : base.GetboolAsString(ColumnNames.Deleted);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Deleted);
				else
					this.Deleted = base.SetboolAsString(ColumnNames.Deleted, value);
			}
		}

		public virtual string s_CreatedDate
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.CreatedDate) ? string.Empty : base.GetDateTimeAsString(ColumnNames.CreatedDate);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.CreatedDate);
				else
					this.CreatedDate = base.SetDateTimeAsString(ColumnNames.CreatedDate, value);
			}
		}

		public virtual string s_LastModifiedDate
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.LastModifiedDate) ? string.Empty : base.GetDateTimeAsString(ColumnNames.LastModifiedDate);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.LastModifiedDate);
				else
					this.LastModifiedDate = base.SetDateTimeAsString(ColumnNames.LastModifiedDate, value);
			}
		}

		public virtual string s_LastModifiedByUser
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.LastModifiedByUser) ? string.Empty : base.GetintAsString(ColumnNames.LastModifiedByUser);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.LastModifiedByUser);
				else
					this.LastModifiedByUser = base.SetintAsString(ColumnNames.LastModifiedByUser, value);
			}
		}

		public virtual string s_LastModifiedByCustomer
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.LastModifiedByCustomer) ? string.Empty : base.GetintAsString(ColumnNames.LastModifiedByCustomer);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.LastModifiedByCustomer);
				else
					this.LastModifiedByCustomer = base.SetintAsString(ColumnNames.LastModifiedByCustomer, value);
			}
		}

		public virtual string s_BranchID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.BranchID) ? string.Empty : base.GetintAsString(ColumnNames.BranchID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.BranchID);
				else
					this.BranchID = base.SetintAsString(ColumnNames.BranchID, value);
			}
		}

		public virtual string s_VoucherID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.VoucherID) ? string.Empty : base.GetGuidAsString(ColumnNames.VoucherID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.VoucherID);
				else
					this.VoucherID = base.SetGuidAsString(ColumnNames.VoucherID, value);
			}
		}


		#endregion		
	
		#region Where Clause
		public class WhereClause
		{
			public WhereClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffWhereParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffWhereParameter(this);
					}

					return _tearOff;
				}
			}

			#region WhereParameter TearOff's
			public class TearOffWhereParameter
			{
				public TearOffWhereParameter(WhereClause clause)
				{
					this._clause = clause;
				}
				
				
				public WhereParameter ID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ID, Parameters.ID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter OrderNo
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.OrderNo, Parameters.OrderNo);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter CustomerID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.CustomerID, Parameters.CustomerID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter CustomerAddress
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.CustomerAddress, Parameters.CustomerAddress);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter CustomerName
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.CustomerName, Parameters.CustomerName);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter CustomerPhone
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.CustomerPhone, Parameters.CustomerPhone);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter PreferredShipDate
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.PreferredShipDate, Parameters.PreferredShipDate);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter ShipAddress
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ShipAddress, Parameters.ShipAddress);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Note
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Note, Parameters.Note);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter ShipDate
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ShipDate, Parameters.ShipDate);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter PaymentMethodID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.PaymentMethodID, Parameters.PaymentMethodID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter TotalAmount
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.TotalAmount, Parameters.TotalAmount);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter GST
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.GST, Parameters.GST);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter StatusID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.StatusID, Parameters.StatusID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter InvoiceID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.InvoiceID, Parameters.InvoiceID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Deleted
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Deleted, Parameters.Deleted);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter CreatedDate
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.CreatedDate, Parameters.CreatedDate);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter LastModifiedDate
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.LastModifiedDate, Parameters.LastModifiedDate);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter LastModifiedByUser
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.LastModifiedByUser, Parameters.LastModifiedByUser);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter LastModifiedByCustomer
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.LastModifiedByCustomer, Parameters.LastModifiedByCustomer);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter BranchID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.BranchID, Parameters.BranchID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter VoucherID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.VoucherID, Parameters.VoucherID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}


				private WhereClause _clause;
			}
			#endregion
		
			public WhereParameter ID
		    {
				get
		        {
					if(_ID_W == null)
	        	    {
						_ID_W = TearOff.ID;
					}
					return _ID_W;
				}
			}

			public WhereParameter OrderNo
		    {
				get
		        {
					if(_OrderNo_W == null)
	        	    {
						_OrderNo_W = TearOff.OrderNo;
					}
					return _OrderNo_W;
				}
			}

			public WhereParameter CustomerID
		    {
				get
		        {
					if(_CustomerID_W == null)
	        	    {
						_CustomerID_W = TearOff.CustomerID;
					}
					return _CustomerID_W;
				}
			}

			public WhereParameter CustomerAddress
		    {
				get
		        {
					if(_CustomerAddress_W == null)
	        	    {
						_CustomerAddress_W = TearOff.CustomerAddress;
					}
					return _CustomerAddress_W;
				}
			}

			public WhereParameter CustomerName
		    {
				get
		        {
					if(_CustomerName_W == null)
	        	    {
						_CustomerName_W = TearOff.CustomerName;
					}
					return _CustomerName_W;
				}
			}

			public WhereParameter CustomerPhone
		    {
				get
		        {
					if(_CustomerPhone_W == null)
	        	    {
						_CustomerPhone_W = TearOff.CustomerPhone;
					}
					return _CustomerPhone_W;
				}
			}

			public WhereParameter PreferredShipDate
		    {
				get
		        {
					if(_PreferredShipDate_W == null)
	        	    {
						_PreferredShipDate_W = TearOff.PreferredShipDate;
					}
					return _PreferredShipDate_W;
				}
			}

			public WhereParameter ShipAddress
		    {
				get
		        {
					if(_ShipAddress_W == null)
	        	    {
						_ShipAddress_W = TearOff.ShipAddress;
					}
					return _ShipAddress_W;
				}
			}

			public WhereParameter Note
		    {
				get
		        {
					if(_Note_W == null)
	        	    {
						_Note_W = TearOff.Note;
					}
					return _Note_W;
				}
			}

			public WhereParameter ShipDate
		    {
				get
		        {
					if(_ShipDate_W == null)
	        	    {
						_ShipDate_W = TearOff.ShipDate;
					}
					return _ShipDate_W;
				}
			}

			public WhereParameter PaymentMethodID
		    {
				get
		        {
					if(_PaymentMethodID_W == null)
	        	    {
						_PaymentMethodID_W = TearOff.PaymentMethodID;
					}
					return _PaymentMethodID_W;
				}
			}

			public WhereParameter TotalAmount
		    {
				get
		        {
					if(_TotalAmount_W == null)
	        	    {
						_TotalAmount_W = TearOff.TotalAmount;
					}
					return _TotalAmount_W;
				}
			}

			public WhereParameter GST
		    {
				get
		        {
					if(_GST_W == null)
	        	    {
						_GST_W = TearOff.GST;
					}
					return _GST_W;
				}
			}

			public WhereParameter StatusID
		    {
				get
		        {
					if(_StatusID_W == null)
	        	    {
						_StatusID_W = TearOff.StatusID;
					}
					return _StatusID_W;
				}
			}

			public WhereParameter InvoiceID
		    {
				get
		        {
					if(_InvoiceID_W == null)
	        	    {
						_InvoiceID_W = TearOff.InvoiceID;
					}
					return _InvoiceID_W;
				}
			}

			public WhereParameter Deleted
		    {
				get
		        {
					if(_Deleted_W == null)
	        	    {
						_Deleted_W = TearOff.Deleted;
					}
					return _Deleted_W;
				}
			}

			public WhereParameter CreatedDate
		    {
				get
		        {
					if(_CreatedDate_W == null)
	        	    {
						_CreatedDate_W = TearOff.CreatedDate;
					}
					return _CreatedDate_W;
				}
			}

			public WhereParameter LastModifiedDate
		    {
				get
		        {
					if(_LastModifiedDate_W == null)
	        	    {
						_LastModifiedDate_W = TearOff.LastModifiedDate;
					}
					return _LastModifiedDate_W;
				}
			}

			public WhereParameter LastModifiedByUser
		    {
				get
		        {
					if(_LastModifiedByUser_W == null)
	        	    {
						_LastModifiedByUser_W = TearOff.LastModifiedByUser;
					}
					return _LastModifiedByUser_W;
				}
			}

			public WhereParameter LastModifiedByCustomer
		    {
				get
		        {
					if(_LastModifiedByCustomer_W == null)
	        	    {
						_LastModifiedByCustomer_W = TearOff.LastModifiedByCustomer;
					}
					return _LastModifiedByCustomer_W;
				}
			}

			public WhereParameter BranchID
		    {
				get
		        {
					if(_BranchID_W == null)
	        	    {
						_BranchID_W = TearOff.BranchID;
					}
					return _BranchID_W;
				}
			}

			public WhereParameter VoucherID
		    {
				get
		        {
					if(_VoucherID_W == null)
	        	    {
						_VoucherID_W = TearOff.VoucherID;
					}
					return _VoucherID_W;
				}
			}

			private WhereParameter _ID_W = null;
			private WhereParameter _OrderNo_W = null;
			private WhereParameter _CustomerID_W = null;
			private WhereParameter _CustomerAddress_W = null;
			private WhereParameter _CustomerName_W = null;
			private WhereParameter _CustomerPhone_W = null;
			private WhereParameter _PreferredShipDate_W = null;
			private WhereParameter _ShipAddress_W = null;
			private WhereParameter _Note_W = null;
			private WhereParameter _ShipDate_W = null;
			private WhereParameter _PaymentMethodID_W = null;
			private WhereParameter _TotalAmount_W = null;
			private WhereParameter _GST_W = null;
			private WhereParameter _StatusID_W = null;
			private WhereParameter _InvoiceID_W = null;
			private WhereParameter _Deleted_W = null;
			private WhereParameter _CreatedDate_W = null;
			private WhereParameter _LastModifiedDate_W = null;
			private WhereParameter _LastModifiedByUser_W = null;
			private WhereParameter _LastModifiedByCustomer_W = null;
			private WhereParameter _BranchID_W = null;
			private WhereParameter _VoucherID_W = null;

			public void WhereClauseReset()
			{
				_ID_W = null;
				_OrderNo_W = null;
				_CustomerID_W = null;
				_CustomerAddress_W = null;
				_CustomerName_W = null;
				_CustomerPhone_W = null;
				_PreferredShipDate_W = null;
				_ShipAddress_W = null;
				_Note_W = null;
				_ShipDate_W = null;
				_PaymentMethodID_W = null;
				_TotalAmount_W = null;
				_GST_W = null;
				_StatusID_W = null;
				_InvoiceID_W = null;
				_Deleted_W = null;
				_CreatedDate_W = null;
				_LastModifiedDate_W = null;
				_LastModifiedByUser_W = null;
				_LastModifiedByCustomer_W = null;
				_BranchID_W = null;
				_VoucherID_W = null;

				this._entity.Query.FlushWhereParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffWhereParameter _tearOff;
			
		}
	
		public WhereClause Where
		{
			get
			{
				if(_whereClause == null)
				{
					_whereClause = new WhereClause(this);
				}
		
				return _whereClause;
			}
		}
		
		private WhereClause _whereClause = null;	
		#endregion
	
		#region Aggregate Clause
		public class AggregateClause
		{
			public AggregateClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffAggregateParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffAggregateParameter(this);
					}

					return _tearOff;
				}
			}

			#region AggregateParameter TearOff's
			public class TearOffAggregateParameter
			{
				public TearOffAggregateParameter(AggregateClause clause)
				{
					this._clause = clause;
				}
				
				
				public AggregateParameter ID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ID, Parameters.ID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter OrderNo
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.OrderNo, Parameters.OrderNo);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter CustomerID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.CustomerID, Parameters.CustomerID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter CustomerAddress
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.CustomerAddress, Parameters.CustomerAddress);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter CustomerName
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.CustomerName, Parameters.CustomerName);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter CustomerPhone
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.CustomerPhone, Parameters.CustomerPhone);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter PreferredShipDate
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.PreferredShipDate, Parameters.PreferredShipDate);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter ShipAddress
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ShipAddress, Parameters.ShipAddress);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Note
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Note, Parameters.Note);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter ShipDate
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ShipDate, Parameters.ShipDate);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter PaymentMethodID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.PaymentMethodID, Parameters.PaymentMethodID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter TotalAmount
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.TotalAmount, Parameters.TotalAmount);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter GST
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.GST, Parameters.GST);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter StatusID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.StatusID, Parameters.StatusID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter InvoiceID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.InvoiceID, Parameters.InvoiceID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Deleted
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Deleted, Parameters.Deleted);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter CreatedDate
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.CreatedDate, Parameters.CreatedDate);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter LastModifiedDate
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.LastModifiedDate, Parameters.LastModifiedDate);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter LastModifiedByUser
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.LastModifiedByUser, Parameters.LastModifiedByUser);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter LastModifiedByCustomer
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.LastModifiedByCustomer, Parameters.LastModifiedByCustomer);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter BranchID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.BranchID, Parameters.BranchID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter VoucherID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.VoucherID, Parameters.VoucherID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}


				private AggregateClause _clause;
			}
			#endregion
		
			public AggregateParameter ID
		    {
				get
		        {
					if(_ID_W == null)
	        	    {
						_ID_W = TearOff.ID;
					}
					return _ID_W;
				}
			}

			public AggregateParameter OrderNo
		    {
				get
		        {
					if(_OrderNo_W == null)
	        	    {
						_OrderNo_W = TearOff.OrderNo;
					}
					return _OrderNo_W;
				}
			}

			public AggregateParameter CustomerID
		    {
				get
		        {
					if(_CustomerID_W == null)
	        	    {
						_CustomerID_W = TearOff.CustomerID;
					}
					return _CustomerID_W;
				}
			}

			public AggregateParameter CustomerAddress
		    {
				get
		        {
					if(_CustomerAddress_W == null)
	        	    {
						_CustomerAddress_W = TearOff.CustomerAddress;
					}
					return _CustomerAddress_W;
				}
			}

			public AggregateParameter CustomerName
		    {
				get
		        {
					if(_CustomerName_W == null)
	        	    {
						_CustomerName_W = TearOff.CustomerName;
					}
					return _CustomerName_W;
				}
			}

			public AggregateParameter CustomerPhone
		    {
				get
		        {
					if(_CustomerPhone_W == null)
	        	    {
						_CustomerPhone_W = TearOff.CustomerPhone;
					}
					return _CustomerPhone_W;
				}
			}

			public AggregateParameter PreferredShipDate
		    {
				get
		        {
					if(_PreferredShipDate_W == null)
	        	    {
						_PreferredShipDate_W = TearOff.PreferredShipDate;
					}
					return _PreferredShipDate_W;
				}
			}

			public AggregateParameter ShipAddress
		    {
				get
		        {
					if(_ShipAddress_W == null)
	        	    {
						_ShipAddress_W = TearOff.ShipAddress;
					}
					return _ShipAddress_W;
				}
			}

			public AggregateParameter Note
		    {
				get
		        {
					if(_Note_W == null)
	        	    {
						_Note_W = TearOff.Note;
					}
					return _Note_W;
				}
			}

			public AggregateParameter ShipDate
		    {
				get
		        {
					if(_ShipDate_W == null)
	        	    {
						_ShipDate_W = TearOff.ShipDate;
					}
					return _ShipDate_W;
				}
			}

			public AggregateParameter PaymentMethodID
		    {
				get
		        {
					if(_PaymentMethodID_W == null)
	        	    {
						_PaymentMethodID_W = TearOff.PaymentMethodID;
					}
					return _PaymentMethodID_W;
				}
			}

			public AggregateParameter TotalAmount
		    {
				get
		        {
					if(_TotalAmount_W == null)
	        	    {
						_TotalAmount_W = TearOff.TotalAmount;
					}
					return _TotalAmount_W;
				}
			}

			public AggregateParameter GST
		    {
				get
		        {
					if(_GST_W == null)
	        	    {
						_GST_W = TearOff.GST;
					}
					return _GST_W;
				}
			}

			public AggregateParameter StatusID
		    {
				get
		        {
					if(_StatusID_W == null)
	        	    {
						_StatusID_W = TearOff.StatusID;
					}
					return _StatusID_W;
				}
			}

			public AggregateParameter InvoiceID
		    {
				get
		        {
					if(_InvoiceID_W == null)
	        	    {
						_InvoiceID_W = TearOff.InvoiceID;
					}
					return _InvoiceID_W;
				}
			}

			public AggregateParameter Deleted
		    {
				get
		        {
					if(_Deleted_W == null)
	        	    {
						_Deleted_W = TearOff.Deleted;
					}
					return _Deleted_W;
				}
			}

			public AggregateParameter CreatedDate
		    {
				get
		        {
					if(_CreatedDate_W == null)
	        	    {
						_CreatedDate_W = TearOff.CreatedDate;
					}
					return _CreatedDate_W;
				}
			}

			public AggregateParameter LastModifiedDate
		    {
				get
		        {
					if(_LastModifiedDate_W == null)
	        	    {
						_LastModifiedDate_W = TearOff.LastModifiedDate;
					}
					return _LastModifiedDate_W;
				}
			}

			public AggregateParameter LastModifiedByUser
		    {
				get
		        {
					if(_LastModifiedByUser_W == null)
	        	    {
						_LastModifiedByUser_W = TearOff.LastModifiedByUser;
					}
					return _LastModifiedByUser_W;
				}
			}

			public AggregateParameter LastModifiedByCustomer
		    {
				get
		        {
					if(_LastModifiedByCustomer_W == null)
	        	    {
						_LastModifiedByCustomer_W = TearOff.LastModifiedByCustomer;
					}
					return _LastModifiedByCustomer_W;
				}
			}

			public AggregateParameter BranchID
		    {
				get
		        {
					if(_BranchID_W == null)
	        	    {
						_BranchID_W = TearOff.BranchID;
					}
					return _BranchID_W;
				}
			}

			public AggregateParameter VoucherID
		    {
				get
		        {
					if(_VoucherID_W == null)
	        	    {
						_VoucherID_W = TearOff.VoucherID;
					}
					return _VoucherID_W;
				}
			}

			private AggregateParameter _ID_W = null;
			private AggregateParameter _OrderNo_W = null;
			private AggregateParameter _CustomerID_W = null;
			private AggregateParameter _CustomerAddress_W = null;
			private AggregateParameter _CustomerName_W = null;
			private AggregateParameter _CustomerPhone_W = null;
			private AggregateParameter _PreferredShipDate_W = null;
			private AggregateParameter _ShipAddress_W = null;
			private AggregateParameter _Note_W = null;
			private AggregateParameter _ShipDate_W = null;
			private AggregateParameter _PaymentMethodID_W = null;
			private AggregateParameter _TotalAmount_W = null;
			private AggregateParameter _GST_W = null;
			private AggregateParameter _StatusID_W = null;
			private AggregateParameter _InvoiceID_W = null;
			private AggregateParameter _Deleted_W = null;
			private AggregateParameter _CreatedDate_W = null;
			private AggregateParameter _LastModifiedDate_W = null;
			private AggregateParameter _LastModifiedByUser_W = null;
			private AggregateParameter _LastModifiedByCustomer_W = null;
			private AggregateParameter _BranchID_W = null;
			private AggregateParameter _VoucherID_W = null;

			public void AggregateClauseReset()
			{
				_ID_W = null;
				_OrderNo_W = null;
				_CustomerID_W = null;
				_CustomerAddress_W = null;
				_CustomerName_W = null;
				_CustomerPhone_W = null;
				_PreferredShipDate_W = null;
				_ShipAddress_W = null;
				_Note_W = null;
				_ShipDate_W = null;
				_PaymentMethodID_W = null;
				_TotalAmount_W = null;
				_GST_W = null;
				_StatusID_W = null;
				_InvoiceID_W = null;
				_Deleted_W = null;
				_CreatedDate_W = null;
				_LastModifiedDate_W = null;
				_LastModifiedByUser_W = null;
				_LastModifiedByCustomer_W = null;
				_BranchID_W = null;
				_VoucherID_W = null;

				this._entity.Query.FlushAggregateParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffAggregateParameter _tearOff;
			
		}
	
		public AggregateClause Aggregate
		{
			get
			{
				if(_aggregateClause == null)
				{
					_aggregateClause = new AggregateClause(this);
				}
		
				return _aggregateClause;
			}
		}
		
		private AggregateClause _aggregateClause = null;	
		#endregion
	
		protected override IDbCommand GetInsertCommand() 
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_CustomerOrdersInsert]";
	
			CreateParameters(cmd);
			
			SqlParameter p;
			p = cmd.Parameters[Parameters.ID.ParameterName];
			p.Direction = ParameterDirection.Output;
    
			return cmd;
		}
	
		protected override IDbCommand GetUpdateCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_CustomerOrdersUpdate]";
	
			CreateParameters(cmd);
			      
			return cmd;
		}
	
		protected override IDbCommand GetDeleteCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_CustomerOrdersDelete]";
	
			SqlParameter p;
			p = cmd.Parameters.Add(Parameters.ID);
			p.SourceColumn = ColumnNames.ID;
			p.SourceVersion = DataRowVersion.Current;

  
			return cmd;
		}
		
		private IDbCommand CreateParameters(SqlCommand cmd)
		{
			SqlParameter p;
		
			p = cmd.Parameters.Add(Parameters.ID);
			p.SourceColumn = ColumnNames.ID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.OrderNo);
			p.SourceColumn = ColumnNames.OrderNo;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.CustomerID);
			p.SourceColumn = ColumnNames.CustomerID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.CustomerAddress);
			p.SourceColumn = ColumnNames.CustomerAddress;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.CustomerName);
			p.SourceColumn = ColumnNames.CustomerName;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.CustomerPhone);
			p.SourceColumn = ColumnNames.CustomerPhone;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.PreferredShipDate);
			p.SourceColumn = ColumnNames.PreferredShipDate;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.ShipAddress);
			p.SourceColumn = ColumnNames.ShipAddress;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Note);
			p.SourceColumn = ColumnNames.Note;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.ShipDate);
			p.SourceColumn = ColumnNames.ShipDate;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.PaymentMethodID);
			p.SourceColumn = ColumnNames.PaymentMethodID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.TotalAmount);
			p.SourceColumn = ColumnNames.TotalAmount;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.GST);
			p.SourceColumn = ColumnNames.GST;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.StatusID);
			p.SourceColumn = ColumnNames.StatusID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.InvoiceID);
			p.SourceColumn = ColumnNames.InvoiceID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Deleted);
			p.SourceColumn = ColumnNames.Deleted;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.CreatedDate);
			p.SourceColumn = ColumnNames.CreatedDate;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.LastModifiedDate);
			p.SourceColumn = ColumnNames.LastModifiedDate;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.LastModifiedByUser);
			p.SourceColumn = ColumnNames.LastModifiedByUser;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.LastModifiedByCustomer);
			p.SourceColumn = ColumnNames.LastModifiedByCustomer;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.BranchID);
			p.SourceColumn = ColumnNames.BranchID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.VoucherID);
			p.SourceColumn = ColumnNames.VoucherID;
			p.SourceVersion = DataRowVersion.Current;


			return cmd;
		}
	}
}
